<?php

/**
 * 商圈管理 
 *
 */ 

class bcAction extends backendAction
{
    public function _initialize() {
        parent::_initialize();
    }
    
    public function _before_index() {  
        $big_menu = array(
            'title' => L('add_bc'),
            'iframe' => U(MODULE_NAME.'/add'),
            'id' => 'add',
            'width' => '500',
            'height' => '100'
        );
        $this->assign('big_menu', $big_menu);        
    }
    
    public function ajax_check_name() {
        $name = $this->_get('J_name', 'trim');
        $id   = $this->_get('id', 'intval');
        $id = intval($id);
        $res = M('bc')->where('name="'.$name.'" and `id`!='.$id)->find();
        if ($res) {
            echo 0;
        } else {
            echo 1;
        }
    }
    
    
    /**
     * 获取请求参数生成条件数组
     */
    protected function _search() {
        //生成查询条件       
        ($name = $this->_request('name', 'trim')) && $map['name'] = array('like', '%'.$name.'%'); 
        
        $this->assign('search', array(
            'name'=>$name,
        ));               
        return $map;
    }
}

?>